<?php
// +----------------------------------------------------------------------
// |订单管理控制器
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\BaseController;
use think\facade\View;
use think\facade\Request;
use app\common\system\OrderService;
use app\common\Model\OrderModel;
use think\facade\Db;

class Order extends BaseController
{
   
    //订单列表 
    public function index()
    {
        //物流渠道的信息
        $field = 'id,name';//要显示的字段       
        $where = [];//查询条件        
        $where[]=['status','=',1];//查询物流渠道  
        $logistice_channel = $this->infos(Db::name('logistice_channel'),$field,$where);
        //店铺
        $field = 'id,name';//要显示的字段       
        $where = [];//查询条件        
        $where[]=['status','=',1];//查询物流渠道  
        $shops = $this->infos(Db::name('shops'),$field,$where);

        if(request()->isPost()){           
            $param = request()->post();
            $data = OrderService::list($param,$logistice_channel,$shops);        
            success($data);    
        }else{             
             View::assign('status', json_encode( (new OrderModel())->getAllStatus()));          
            return view::fetch();
        }  
    }
     

    //订单详情
    public function dateil()
    {                           
        if(request()->isPost()){
            $param = request()->post();        
            $data = OrderService::dateil($param);    
            success($data);        
        }else{
            $param = request()->get();              
            View::assign('orderid',$param['orderid']);           
            return view::fetch();
        }    
    }
    //首页看板数据
    public function list(){
      $param = request()->post();
        $data = OrderService::lists($param);        
        success($data);
    }
     
   // 修改批注
   public function confirmnotes(){
        $param = request()->post();
        $data = OrderService::confirmnotes($param);        
        success($data);
   }


}